package com.bjpowernode.javaweb.servlet;

import jakarta.servlet.ServletException;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;

import java.io.IOException;
import java.io.PrintWriter;


//@WebServlet(urlPatterns="/welcome")
//@WebServlet(value={"/welcome1","/welcome2"})
//当注解是一个数组并且属性值只有一个时，大括号可以省略
//如果时value属性并且只有一个值时，属性名也可以省略
@WebServlet("/wel")
public class WelcomeServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        response.setContentType("text/html;charset=utf-8");
        PrintWriter out= response.getWriter();

        out.print("欢迎学习Servlet<br/>");
    }
}
